package iie.tools;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 *
 * @author wjt
 */
public class ComTools {

    public static List getArray(Object o) {
        if (o.getClass().isArray()) {
            Object v = o;
            int n = Array.getLength(v);
            List l = new ArrayList(n);
            for (int i = 0; i < n; ++i) {
                l.add(Array.get(v, i));
            }
            return l;
        } else {
            return Arrays.asList(o);
        }
    }

}
